using Bean.Infrastructure.Extensions;
using Bean.PolicyProductBackEnd.Handler;
using Bean.ProductService.KN;
using Bean.Quartz.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

internal class Program
{
    private static void Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);

        builder.AddRedisConfig().AddLogging("Nlog.config");

        builder.Services.AddQuartz();
        builder.Services.AddHttpClient();

        builder.Services.AddTransient<JYCSKNB2MTSService>(); // 或者使用 AddScoped / AddSingleton 根据需要
        builder.Services.AddHostedService<JYCSKNB2MTSHandler>();

        // builder.Services.AddSingleton<TestJob>();



        // // ����Redis�Ķ���ģʽ
        // builder.Services.AddSingleton<TestSubscribe>();
        //
        //
        var app = builder.Build();
        //
        // var _testSubscribe = app.Services.GetService<TestSubscribe>();
        //
        // app.Lifetime.ApplicationStarted.Register(() => { _testSubscribe?.Start(); });
        //
        // app.Lifetime.ApplicationStopped.Register(() => { _testSubscribe?.Stop(); });


        // // ��ʱ����
        // app.UseQuartz(async startup =>
        // {
        //     await startup.AddTimerJob<TestJob>("Test", JobIntervalType.Seconds, 2);
        // });


        app.Run();
    }
}